import React from "react";
// import NumberInput from "./components/NumberInput"
import { useState } from "react";
export default function SelectBase(props) {
  const [value, setValue] = useState(props.defaultValue);
  const options = props.options.map((item) => {
    return (
      <option key={item.value} value={item.value}>
        {item.label}
      </option>
    );
  });
  const onChange = (e) => {
    setValue(e.target.value);
    props.onChange && props.onChange(e.target.value);
  };
  return (
    <div>
      <select
        value={props.value}
        onChange={(e) => {
        onChange(e);
        }}
      >
        {options}
      </select>
    </div>
  );
}
